home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / Implementation / DocShell / DocUtilP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-13  |  3.3 KB  |  85 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DocUtilP.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>      12/18/96    DH        1375780: Adding CStackPtrList which is a
  13.                                     list which allocates memory on the stack
  14.                                     instead of the heap.
  15.          <1>    18.09.1996    NP        first checked in
  16.  
  17.     To Do:
  18. */
  19.  
  20. #ifndef _DOCUTILP_
  21. #define _DOCUTILP_
  22.  
  23. const int maxListItems = 100;
  24.  
  25. ODDocument*    ODGetFirstOpenDocument(Environment* ev, ODSession* session);
  26. //------------------------------------------------------------------------------
  27. // ODGetFirstOpenDocument
  28. //    A pointer to the first document in the collection of open documents is returned.
  29. //    If the collection is empty, then kODNULL is returned.
  30. //    It is the caller's responsibility to Acquire the returned document it she wishes to 
  31. //    hold onto it.
  32. //------------------------------------------------------------------------------
  33. ODBoolean ODDeleteDocument(Environment* ev, ODSession* session, ODDocument* document);
  34. //------------------------------------------------------------------------------
  35. // ODDeleteDocument
  36. //    Saves & closes the document and moves it to the trash.
  37. //    If there are no more open windows once the document is closed,
  38. //    then kODTrue is returned.
  39. //------------------------------------------------------------------------------
  40. void ODRevertDocument(Environment* ev, ODSession* session, ODDocument* document);
  41. //------------------------------------------------------------------------------
  42. // ODRevertDocument
  43. //    Reverts the document if there is an associated tempdraft.  Otherwise does nothing.
  44. //  Note: it is advised that you get a confirmation from the user BEFORE
  45. //    calling this function.
  46. //------------------------------------------------------------------------------
  47. ODBoolean ODIsTempDocument(Environment* ev, ODSession* session, ODDocument* document);
  48. //------------------------------------------------------------------------------
  49. // ODIsTempDocument
  50. //  Returns whether or not the document is a temp document.
  51. //------------------------------------------------------------------------------
  52. void ODSetIsTempDocument(Environment* ev, ODDraft* draft, ODBoolean isTemp);
  53. //------------------------------------------------------------------------------
  54. // ODSetIsTempDocument
  55. //  Sets whether the document is a temp document or not.
  56. //------------------------------------------------------------------------------
  57.  
  58. // Stack Pointer List class. Stores a list of pointers, but allocates data for the
  59. // list on the stack, not the heap, so that it will work better under low memory
  60. // conditions.
  61.  
  62. // Limitations:
  63. //            Only allows storing, at most, 100 4-byte pointer entries.
  64. //            Do not store null pointers in this list!
  65.  
  66. class CStackPtrList
  67. {
  68.     public:
  69.         CStackPtrList( void ) { nextPos = 0; numListItems = 0; }
  70.         ~CStackPtrList() {}
  71.         
  72.         ODError Add( ODPtr theItem );
  73.         ODPtr First( void )    { nextPos = 0; return data[nextPos++]; }
  74.         ODPtr Next( void );
  75.         int   GetNumListItems( void) { return numListItems; }
  76.     private:
  77.         ODPtr     data[maxListItems];    // The data for all of the pointers in the list.
  78.         int       numListItems;        // Number of items currently in the list.
  79.         ODUByte nextPos;             // Denotes the position in the array of the pointer
  80.                                     // that will be returned when Next is called.    
  81. };
  82.  
  83.  
  84. #endif /* _DOCUTILP_ */
  85.